跳到主要内容

SetRange

Sets a range to the current protected range.

Syntax

expression.SetRange(sRange);

expression - A variable that represents a ApiProtectedRange class.

Parameters

NameRequired/OptionalData typeDefaultDescription
sRangeRequiredstringThe cell range which will be set for the current protected range.

Returns

boolean

Example

This example changes the the user protected range.

var oWorksheet = Api.GetActiveSheet();
oWorksheet.AddProtectedRange("protectedRange", "Sheet1!$A$1:$B$1");
var protectedRange = oWorksheet.GetProtectedRange("protectedRange");
protectedRange.SetRange("Sheet1!$A$2:$B$2");